<!DOCTYPE html>
<html>
	<head>
		<meta http-equiv="Content-type" content="text/html; charset=utf-8">
		<title>Async Simple Input - Output Group example</title>
		<style type="text/css">
			@import "css/app-format.css";
			@import "../../../../dijit/themes/claro/claro.css";
		</style>

<script type="text/javascript" djConfig="parseOnLoad:0,isDebug:1,async:1" src="../../../../dojo/dojo.js"></script>
<script type="text/javascript">
 		var model;
 
		require([
		'dojo/parser',
        'dojox/mvc',
		'dojox/mvc/Group',
		'dojox/mvc/Output',
		'dojo/parser',
		'dijit/form/TextBox',
		'dijit/form/Button'], function(){

			// The dojox.mvc.StatefulModel class creates a data model instance
			// where each leaf within the data model is decorated with dojo.Stateful
			// properties that widgets can bind to and watch for their changes.
			model = dojox.mvc.newStatefulModel({ data : { "First" : "John", "Last" : "Doe", "Email" : "jdoe@example.com" }});
				require([
					'dojo/domReady!'
				], function(){
				   dojo.parser.parse();
				});
				
		}); // end onload

		</script>
	</head>
	<body class="claro">
		<div id="wrapper">
			<div id="header">
				<div id="navigation"></div>
				<div id="headerInsert">
					<h1>Input Output Sync</h1>
					<h2>Data Binding Example</h2>
				</div>
			</div>
			<div id="main">
				<div id="leftNav"></div>
				<div id="mainContent" dojoType="dojox.mvc.Group" data-dojo-props="ref: 'expr:model'">
					<div class="row">
						<label class="cell" for="firstnameInput">First:</label>
						<input class="cell" id="firstnameInput" data-dojo-type="dijit.form.TextBox"
									data-dojo-props="ref: model.First"></input>
						<!-- Content in output below will always be in sync with value of textbox above -->
						<span data-dojo-type="dojox.mvc.Output" data-dojo-props="ref: 'First'">
						(first name is: ${this.value})
						</span>
					</div>
				<div class="row">
					<label class="cell" for="lastnameInput">Last:</label>
					<input class="cell" id="lastnameInput" data-dojo-type="dijit.form.TextBox"
									data-dojo-props="ref: model.Last"></input>
					<span data-dojo-type="dojox.mvc.Output" data-dojo-props="ref: 'Last'">
						(last name is: ${this.value})
					</span>
				</div>
				<div class="row">
					<label class="cell" for="emailInput">Email:</label>
					<input class="cell" id="emailInput" data-dojo-type="dijit.form.TextBox"
									data-dojo-props="ref: model.Email"></input>
					<span data-dojo-type="dojox.mvc.Output" data-dojo-props="ref: 'Email'">
					(email is: ${this.value})
					</span>
				</div>
					<br/>Model:
					<button id="reset" type="button" data-dojo-type="dijit.form.Button" data-dojo-props="onClick: function(){model.reset();}">Reset</button>
				</div>
			</div>
		</div>
	</body>
</html>
